import { Module } from '@nestjs/common';
import { AppController } from './app.controller';
import { AppService } from './app.service';
import { ConfigModule } from '@nestjs/config';
import { TypeOrmModule } from '@nestjs/typeorm';
import {UserModule} from './module/system/user/user.module';
import { UuidService } from './uuid/uuid.service';
import { RoleModule } from './module/system/role/role.module';
import { MenuModule } from './module/system/menu/menu.module';
import { AuthModule } from './module/system/auth/auth.module';
import { PoetryModule} from './module/poetry/poetry.module';
import { ClassicsModule } from './module/classics/classics.module';
import { JwtModule } from '@nestjs/jwt';
@Module({
  imports: [
    ConfigModule.forRoot({
      isGlobal: true
    }),
    TypeOrmModule.forRoot({
      type: 'mysql',
      host: '124.70.143.238',
      port: 3306,
      username: 'ghost',
      password: 'MDghost2016',
      database: 'GhostBlog',
      entities: [__dirname + '/**/*.entity{.ts,.js}'],
      synchronize: true,
      charset: 'utf8mb4'
    }),
    JwtModule.register({
      global: true,
      secret: 'ghost',
      signOptions: { expiresIn: '1d' },
    }),
    UserModule,
    RoleModule,
    MenuModule,
    AuthModule,
    PoetryModule,
    ClassicsModule
  ],
  controllers: [AppController],
  providers: [AppService, UuidService],
})
export class AppModule {}
